<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateMembersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('members', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('pid')->unsigned()->default(0);
			$table->string('path')->default('0')->comment('代系树，如id为1的用户没有推广人则为0,1；id为2的用户推广人是1则为0,1,2');
			$table->string('nickname')->nullable();
			$table->string('headimgurl')->nullable();
			$table->boolean('sex')->nullable()->comment('1男2女');
			$table->integer('age')->nullable()->comment('年龄');
			$table->string('country', 50)->nullable()->comment('国家');
			$table->string('province', 50)->nullable()->comment('省');
			$table->string('city', 50)->nullable()->comment('市');
			$table->string('area', 50)->nullable()->comment('区');
			$table->string('address', 50)->nullable()->comment('详细地址');
			$table->string('mobile')->nullable();
			$table->string('openid')->nullable();
			$table->string('bankId', 22)->nullable()->comment('银行卡号');
			$table->decimal('wallet_all_push_money', 9)->default(0.00)->comment('总提成');
			$table->decimal('wallet_used_push_money', 9)->default(0.00)->comment('已使用的提成');
			$table->decimal('wallet_push_money', 9)->default(0.00)->comment('剩余提成');
			$table->decimal('wallet_withdraw', 9)->default(0.00)->comment('提现金额');
			$table->integer('wallet_spots')->default(0)->comment('剩余景点次数');
			$table->boolean('consume')->default(2)->comment('是否产生消费1是2否');
			$table->boolean('info_complete')->nullable()->default(2)->comment('1已完善2未完善');
			$table->boolean('is_listen')->nullable()->comment('是否试听过1是0否');
			$table->boolean('subscribe')->nullable()->comment('用户是否订阅该公众号标识，值为0时，代表此用户没有关注该公众号，拉取不到其余信息。');
			$table->boolean('status')->nullable()->default(1)->comment('1启用2禁用');
			$table->boolean('role')->nullable()->default(1)->comment('1个人2旅行社');
			$table->timestamps();
			$table->integer('game_num')->nullable()->default(0)->comment('游戏剩余次数');
			$table->integer('promote_num')->nullable()->default(0)->comment('推广人数');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('members');
	}

}
